<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="hmg.common.CommonUtils"%>
<%@ page import="able.com.vo.SearchVO"%>
<%@ page import="java.util.List"%>
<%@ page import="hmg.vo.BoardVO"%>
<%@ page import="hmg.vo.CodeVO"%>
<%--
    JSP Name : jspName.jsp
    Description : 설명을 기술합니다.
    author Kim hyung soo
    since 2012. 8. 28.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 8. 28.     Kim hyung soo     최초 생성
--%>
<%
    List<BoardVO> newsList = (List<BoardVO>) request.getAttribute("NewsList");
    Integer totalNews = (Integer) request.getAttribute("TotalNews");
    List<CodeVO> bizList = (List<CodeVO>) request.getAttribute("BizList");
    List<CodeVO> compList = (List<CodeVO>) request.getAttribute("CompList");

    String listType = CommonUtils.getParameter(request.getParameter("listType"), "0");
    String compType = CommonUtils.getParameter(request.getParameter("compType"), "");
    String currPage = CommonUtils.getParameter(request.getParameter("page"), "1");
    String searchCondition = CommonUtils.getParameter(request.getParameter("searchCondition"), "1");
    String searchKeyword = CommonUtils.getDecodedParameter(request.getParameter("searchKeyword"), "");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>활동 소식 : 사회공헌 7대 부문별 활동 | 현대자동차그룹</title>
<meta name="description" content="현대자동차그룹 사회공헌 7대 부문별 활동 - 사회복지 7대 부문별 활동 소식 게시판" />
<meta name="keywords" content="현대자동차그룹 사회공헌 활동, 현대차그룹 사회공헌 활동, 사회공헌 활동, 사회복지, 사회공헌 후기, 사회공헌 소식" />
<%@ include file="/WEB-INF/jsp/web/kor/include/header.jspf" %>
<script type="text/javascript" src="/hmg/js/web/kor/com/jquery.easing.1.3.js"></script>
<script type="text/javascript">
//<![CDATA[
var page = "<%= currPage %>";

$(document).ready(function(){

    if (page == "")
        page = "1";

    $("#paging").html(getNewsPagingString(<%= totalNews %>, page, 10, 10));
    $("#newsTab<%= listType %>").addClass("on");

});

function fn_list_by_type(listType) {
    document.location.href = "./ActivityList.do?listType=" + listType + "&page=1";
}

function fn_list_search() {
    var condition = $("#searchCondition").val();
    var keyword = $("#searchKeyword").val();

    if (keyword.length < 2) {
        alert("검색어를 2자 이상 입력해 주세요.");
        return;
    }

    keyword = escape(encodeURIComponent(keyword));

    document.location.href = "./ActivityList.do?listType=<%= listType %>&compType=<%= compType %>&searchCondition=" + condition + "&searchKeyword=" + keyword + "&page=1";
}

function fn_move_page(pageNo){
    fn_common_move_page(pageNo, location.search, page, 10, <%= totalNews %>, "./ActivityList.do");
}

//]]>
</script>
</head>
<body>
    <!--wrap-->
    <div id="wrap">
        <!-- skip navigation -->
        <div id="skipnavition">
            <a href="#gnb">메뉴바로가기</a><a href="#content">본문바로가기</a>
        </div>
        <!--// skip navigation -->

        <hr />

        <!-- header-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/left.jspf" %>
        <!--//header-->

        <hr />

        <!--container-->
        <div id="container">
            <div class="scroll-pane">
                <!-- 공통 -->
                <div class="subTitle">
                    <div class="pageTitle">
                        <h2><img src="/hmg/images/web/kor/title/contibute_Board.gif" alt="활동게시판" /></h2>
                        <p class="subCopy"><img src="/hmg/images/web/kor/title/contibute_Board_desc.gif" alt="7대 부문별 공헌활동의 소식을 전해드립니다" /></p>
                    </div>

                    <div class="pageLocation">
                        <ul>
                            <li><a href="/hmg/web/kor/Main.do"><img src="/hmg/images/web/kor/common/location_home.gif" alt="홈"/></a></li>
                            <li><a href="/hmg/web/kor/cbt/ContributeSubMain.do">사회공헌</a></li>
                            <li><a href="/hmg/web/kor/cbt/act/smy/Welfare.do">7대 부문별 활동</a></li>
                            <li class="nowPage"><a href="/hmg/web/kor/cbt/act/ActivityList.do">활동 소식</a></li>
                        </ul>
                    </div>
                </div>
                <!--//공통-->

                <!--contents-->
                <div id="content">
                    <!-- 내용 -->
                    <div class="actvityNews">
                        <div class="activity_Tab">
                            <ul>
                                <li id="newsTab0" class="tab01"><a href="javascript:fn_list_by_type(0);"><span>전체</span></a></li>
                                <li id="newsTab1" class="tab02"><a href="javascript:fn_list_by_type(1);"><span>사회복지</span></a></li>
                                <li id="newsTab2" class="tab03"><a href="javascript:fn_list_by_type(2);"><span>의료보건</span></a></li>
                                <li id="newsTab3" class="tab04"><a href="javascript:fn_list_by_type(3);"><span>교육·학술연구</span></a></li>
                                <li id="newsTab4" class="tab05"><a href="javascript:fn_list_by_type(4);"><span>문화예술·체육</span></a></li>
                                <li id="newsTab5" class="tab06"><a href="javascript:fn_list_by_type(5);"><span>환경</span></a></li>
                                <li id="newsTab6" class="tab07"><a href="javascript:fn_list_by_type(6);"><span>응급·재난구호</span></a></li>
                                <li id="newsTab7" class="tab08"><a href="javascript:fn_list_by_type(7);"><span>국제활동</span></a></li>
                            </ul>
                        </div>

                        <div class="groupNews_Btn">
                            <div class="right_Btn">
                                <a href="#"><img src="/hmg/images/web/kor/btn/btn_select.gif" alt="계열사 선택" /></a>
                            </div>
                            <!--companyWrap-->
                            <div class="companyWrap actvityType">
                                <div class="companyList">
                                    <table summary="계열사 목록">
                                        <caption>계열사목록</caption>
                                        <colgroup>
                                            <col width="13.5%" />
                                            <col width="13%" />
                                            <col width="13%" />
                                            <col width="14.5%" />
                                            <col width="16%" />
                                            <col width="15.5%" />
                                            <col width="14.5%" />
                                        </colgroup>
                                        <thead>
                                            <tr>
<%
    for (int idx = 0; idx < bizList.size(); idx++) {
        CodeVO biz = bizList.get(idx);

        if (idx + 1 < bizList.size())
            out.println("                                           <th scope=\"col\">" + biz.getNameKo() + "</th>");
        else
            out.println("                                           <th scope=\"col\" class=\"last\">" + biz.getNameKo() + "</th>");
    }
%>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
<%
    String prevBizCode = "";
    for (int idx = 0; idx < compList.size(); idx++) {
        CodeVO comp = compList.get(idx);

        if (comp.getUpperValue().equals(prevBizCode) != true) {
            prevBizCode = comp.getUpperValue();

            if (idx == 0)
                out.println("                                           <td class=\"first\">");
            else if (prevBizCode.equals(bizList.get(bizList.size() - 1).getValue()) == true) {
%>
                                                    </ul>
                                                </td>
                                                <td class="last">
<%
            }
            else {
%>
                                                </ul>
                                            </td>
                                            <td>
<%
            }

            out.println("                                               <ul>");
        }

        out.println("                                                   <li><a href=\"./ActivityList.do?listType=" + listType + "&compType=" + comp.getValue() + "&page=1\">" + comp.getNameKo() + "</a></li>");
    }
%>
                                                </ul>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <a href="#" class="compListClose"><img src="/hmg/images/web/kor/btn/btn-close.gif" alt="닫기" /></a>
                            </div>
                        </div>
                        <!--//companyListWrap-->
                        </div>

                        <div class="groupnews_Thumb_List">
<%
    if (newsList == null || newsList.size() == 0)
        out.println("                           <dl style=\"text-align:center;\">등록된 게시물이 없습니다.</dl>");
    else {
        for (int idx = 0; idx < newsList.size(); idx++) {
            BoardVO news = newsList.get(idx);

            if (idx + 1 < newsList.size())
                out.println("                           <dl>");
            else
                out.println("                           <dl class=\"last\">");
%>
                                <dt><%= news.getCompName() %><span class="date"><%= news.getRegDate() %></span><br />
                                <a href="/hmg/web/kor/cbt/act/nws/ActivityView.do?listID=<%= news.getListID() %>&listType=<%= listType %>&compType=<%= compType %>&page=<%= currPage %>"><span class="title"><%= news.getTitle() %></span></a></dt>
                                <dd class="text"><a href="/hmg/web/kor/cbt/act/nws/ActivityView.do?listID=<%= news.getListID() %>&listType=<%= listType %>&compType=<%= compType %>&page=<%= currPage %>"><%= news.getWebContent() %></a></dd>
<%          if (news.getThumbnailImage() != null) { %>
                                <dd class="img"><a href="/hmg/web/kor/cbt/act/nws/ActivityView.do?listID=<%= news.getListID() %>&listType=<%= listType %>&compType=<%= compType %>&page=<%= currPage %>"><img src="<%= news.getThumbnailImage() %>" width="134" height="81" alt="" /></a></dd>
<%
            }
            else {
%>
                                <dd class="img" style="height:81px;">&nbsp;</dd>
<%          } %>
                            </dl>
<%
        }
    }
%>
                        </div>
                        <div class="gropnews_page">
                            <div class="gropnews_page_left">
                                <ul id="paging"></ul>
                            </div>
                            <div class="gropnews_page_right">
                                <ul>
                                    <li><a href="javascript:fn_move_page('prev');"><img src="/hmg/images/web/kor/btn/btn_prev.gif" alt="이전페이지로 이동" /></a></li>
                                    <li><a href="javascript:fn_move_page('next');"><img src="/hmg/images/web/kor/btn/btn_next.gif" alt="다음페이지로 이동" /></a></li>
                                </ul>
                            </div>
                        </div>

                        <!-- searcharea-->
                        <div class="searchArea">
                            <img src="/hmg/images/web/kor/grn/groupnews_Search_Text01.gif" alt="상세검색" class="search_text"/>
                            <label class="hidden" for="">검색 영역</label>
                            <select id="searchCondition">
                                <option value="1"<%= searchCondition.equals("1") == true ? " selected" : "" %>>제목</option>
                                <option value="2"<%= searchCondition.equals("2") == true ? " selected" : "" %>>내용</option>
                                <option value="3"<%= searchCondition.equals("3") == true ? " selected" : "" %>>제목 + 내용</option>
                            </select>
                            <label class="hidden" for="">검색</label>
                            <input type="text" id="searchKeyword" name="searchKeyword" value="<%= searchKeyword %>" title="검색" onkeypress="javascript:if (event.keyCode == 13) { fn_list_search(); }" />
                            <a href="javascript:fn_list_search();"><img src="/hmg/images/web/kor/btn/btn_search.gif" alt="검색" class="search_btn"/></a>
                        </div>
                        <!--// searcharea-->
                    </div>
                    <!--// 내용 -->
                </div>
                <!--//contents-->
            </div>
        </div>
        <!--//container-->

        <hr />

        <!--footer-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/footer.jspf" %>
        <!--//footer-->

        <hr />

        <!--notice-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/notice.jspf" %>
        <!--//notice-->
    </div>
    <!--//wrap-->
</body>
</html>